<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>断网环境下利用pip安装Python离线安装包 | 智能技术</title>
    <meta name="generator" content="VuePress 1.8.2">
    <script data-ad-client="ca-pub-1977396037355374" async="true" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <meta name="description" content="断网环境下利用pip安装Python离线安装包">
    <meta name="baidu-site-verification" content="fP9EQkbGCM">
    
    <link rel="preload" href="/assets/css/0.styles.89695ccf.css" as="style"><link rel="preload" href="/assets/js/app.cee3c598.js" as="script"><link rel="preload" href="/assets/js/24.0d075789.js" as="script"><link rel="prefetch" href="/assets/js/10.81160393.js"><link rel="prefetch" href="/assets/js/11.777111f5.js"><link rel="prefetch" href="/assets/js/12.c58a9b41.js"><link rel="prefetch" href="/assets/js/13.16b64097.js"><link rel="prefetch" href="/assets/js/14.81b84b8b.js"><link rel="prefetch" href="/assets/js/15.ae9bbcfc.js"><link rel="prefetch" href="/assets/js/16.cb71ce72.js"><link rel="prefetch" href="/assets/js/17.7eb91f50.js"><link rel="prefetch" href="/assets/js/18.1f750554.js"><link rel="prefetch" href="/assets/js/19.525a894f.js"><link rel="prefetch" href="/assets/js/2.0a188998.js"><link rel="prefetch" href="/assets/js/20.f186cf8f.js"><link rel="prefetch" href="/assets/js/21.b3e01dc7.js"><link rel="prefetch" href="/assets/js/22.ea0793c3.js"><link rel="prefetch" href="/assets/js/23.da81792d.js"><link rel="prefetch" href="/assets/js/25.901ac41c.js"><link rel="prefetch" href="/assets/js/26.c3112033.js"><link rel="prefetch" href="/assets/js/27.0d727913.js"><link rel="prefetch" href="/assets/js/3.0d59f57e.js"><link rel="prefetch" href="/assets/js/4.58ac6eea.js"><link rel="prefetch" href="/assets/js/5.b48f4120.js"><link rel="prefetch" href="/assets/js/6.6a7eb352.js"><link rel="prefetch" href="/assets/js/7.0a07ef26.js"><link rel="prefetch" href="/assets/js/8.0332c4f5.js"><link rel="prefetch" href="/assets/js/9.9df962ab.js">
    <link rel="stylesheet" href="/assets/css/0.styles.89695ccf.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><section id="global-layout" data-v-4fb7124e><header class="header" data-v-61b62cbe data-v-4fb7124e><div class="header-navbar" data-v-61b62cbe><div class="flex-xbc main header-nav" data-v-61b62cbe><div class="nav-link" data-v-61b62cbe><!----> <nav class="link-list" data-v-61b62cbe><a href="/" class="list-item router-link-active" data-v-61b62cbe>首页</a><a href="/posts/" class="list-item" data-v-61b62cbe>博客</a><a href="/category/" class="list-item" data-v-61b62cbe>分类</a><a href="/tag/" class="list-item" data-v-61b62cbe>标签</a><a href="/about/" class="list-item" data-v-61b62cbe>关于</a></nav></div> <div class="search-box" data-v-61b62cbe><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div></div></div> </header> <!----> <section class="page" data-v-4fb7124e data-v-4fb7124e><section class="info" style="background-image:url(/images/9.jpg);" data-v-52fe94f0><article class="main info-content" data-v-a5c9dc12 data-v-52fe94f0><div class="content-header" data-v-a5c9dc12><h1 class="header-title" data-v-a5c9dc12>断网环境下利用pip安装Python离线安装包</h1></div> <div class="flex-wcc content-tag" data-v-a5c9dc12><div class="inblock tag-list" data-v-a5c9dc12><a href="/category/问题解决/" class="tag-text" data-v-a5c9dc12>问题解决
      </a></div> <span class="tag-space" data-v-a5c9dc12>/</span> <div class="inblock tag-list" data-v-a5c9dc12><a href="/tag/pip/" class="tag-text" data-v-a5c9dc12>pip
      </a><a href="/tag/离线安装/" class="tag-text" data-v-a5c9dc12>离线安装
      </a></div></div> <div class="content content__default" data-v-a5c9dc12><p>从网站提供的编译好的包下载最新版本pip-8.1.2-py2.py3-none-any.whl和wheel-0.29.0-py2.py3-none-any.whl，在packages文件夹中。</p> <p>从pip文档下载get-pip.py</p> <p>python.exe get-pip.py --no-index --find-links=d:\python27\packages</p> <h2 id="打包已安装的包"><a href="#打包已安装的包" class="header-anchor">#</a> 打包已安装的包</h2> <p>在D:python27目录下新建packages文件夹用来存储下载下来的所需安装包。

在 D:Python27Scripts下启动cmd窗口。</p> <p>pip list #查看安装的包
pip freeze &gt;requirements.txt
pip install --download d:\python27\packages -r requirements.txt</p> <h2 id="离线情况安装打包好的包"><a href="#离线情况安装打包好的包" class="header-anchor">#</a> 离线情况安装打包好的包</h2> <p>将packages文件夹和requirement.txt拷贝至离线机器上目录下，packages文件夹放在D:Python27下，requirement.txt放在D:Python27Scripts下。</p> <p>requirements.txt文件放在pip.exe目录下。</p> <p>pip install --no-index --find-index=d:\python27\packages -r requirements.txt</p> <h2 id="补充"><a href="#补充" class="header-anchor">#</a> 补充</h2> <ol><li>下载指定的包到指定文件夹</li></ol> <p>pip install --download d:\python27\packs pandas（-r requirements.txt）</p> <ol start="2"><li>安装指定的离线包</li></ol> <p>pip install --no-index --find-links=d:\python27\packs\ pandas （-r requirements.txt）</p></div> <div class="content-time" data-v-a5c9dc12><time datetime="2017年12月28日" class="time-text" data-v-a5c9dc12>Create Time: 2017年12月28日
    </time> <time datetime="2020年9月13日" class="time-text" data-v-a5c9dc12>Last Updated: 2020年9月13日
    </time></div></article> <section class="flex-xb main info-nav" data-v-e08c9474 data-v-52fe94f0><a href="/2017/12/27/%E4%BB%8Ehdfs%E4%B8%8A%E8%AF%BB%E5%8F%96%E5%B8%A6lzo%E5%8E%8B%E7%BC%A9%E7%9A%84sequencefile%E6%96%87%E4%BB%B6/" class="flex-xb nav-item" data-v-e08c9474><div class="flex-xcc item-img" data-v-e08c9474><img data-src="/images/7.jpg" loading="lazy" alt="从HDFS上读取带lzo压缩的SequenceFile文件" class="img lazy" data-v-e08c9474></div> <article class="flex-ysc item-content" data-v-e08c9474><h2 class="content-title" data-v-e08c9474>从HDFS上读取带lzo压缩的SequenceFile文件</h2> <div class="content" data-v-e08c9474></div></article></a> <a href="/2017/12/27/latex%E5%B9%B6%E6%8E%92%E6%98%BE%E7%A4%BA/" class="flex-xb nav-item" data-v-e08c9474><div class="flex-xcc item-img" data-v-e08c9474><img data-src="/images/4.jpg" loading="lazy" alt="Latex并排显示" class="img lazy" data-v-e08c9474></div> <article class="flex-ysc item-content" data-v-e08c9474><h2 class="content-title" data-v-e08c9474>Latex并排显示</h2> <div class="content" data-v-e08c9474></div></article></a></section> <!----></section></section> <footer class="footer" data-v-5bc4f524 data-v-4fb7124e><nav class="link-list" data-v-5bc4f524><a href="https://gitee.com/tjuchaochao" target="_blank" rel="noopener noreferrer" class="list-item" data-v-5bc4f524>gitee</a></nav> <a href="/" class="copyright router-link-active" data-v-5bc4f524>智能技术 © 2021</a></footer></section><div class="global-ui"><!----><!----></div></div>
    <script src="/assets/js/app.cee3c598.js" defer></script><script src="/assets/js/24.0d075789.js" defer></script>
  </body>
</html>
